{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "# Linear Regression Example\n",
    "\n",
    "This example uses the only the first feature of the `diabetes` dataset, in\n",
    "order to illustrate a two-dimensional plot of this regression technique. The\n",
    "straight line can be seen in the plot, showing how linear regression attempts\n",
    "to draw a straight line that will best minimize the residual sum of squares\n",
    "between the observed responses in the dataset, and the responses predicted by\n",
    "the linear approximation.\n",
    "\n",
    "The coefficients, the residual sum of squares and the variance score are also\n",
    "calculated.\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Automatically created module for IPython interactive environment\n",
      "('Coefficients: \\n', array([ 938.23786125]))\n",
      "('Intercept: \\n', 152.91886182616167)\n",
      "Mean squared error: 2548.07\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAeQAAAFKCAYAAADMuCxnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAFwtJREFUeJzt3X+MbPVd8PHPMkAvpQ1MW1NL9Ql4d/Z6BUWwNmr7xNRO\nO8vaVNEY3bWoNVhr/1BjosY8mMbwKNZoIonG1mpsH8Ex1RSr9u6ODk1jIJpgb4rYS52ZRaiR2wS7\nW36Uy70wd54/ThfYcu/uObt7Zr5z5vVK+OfMOXu/gQ3v+/2ec74zNxqNAgCYrAsmPQAAQJABIAmC\nDAAJEGQASIAgA0ACBBkAEiDIAJAAQQaABFyY56S5ublXR0QrIh6OiGfKHBAAVMyhiLgyIjqj0ehL\n5zspV5Aji/GdBzAoAJhVPx4Rf3G+D/MG+eGIiDvuuCOOHj16AGMCgNnw4IMPxrve9a6Ir7b0fPIG\n+ZmIiKNHj8b111+/v5EBwGza8Zavh7oAIAGCD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wdagAAAAA\nSUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f7f2ac0ced0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "print(__doc__)\n",
    "\n",
    "# Code source: Jaques Grobler\n",
    "# License: BSD 3 clause\n",
    "\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "from sklearn import datasets, linear_model\n",
    "\n",
    "# Load the diabetes dataset\n",
    "diabetes = datasets.load_diabetes()\n",
    "\n",
    "\n",
    "# Use only one feature\n",
    "diabetes_X = diabetes.data[:, np.newaxis, 2]\n",
    "\n",
    "# Split the data into training/testing sets\n",
    "diabetes_X_train = diabetes_X[:-20]\n",
    "diabetes_X_test = diabetes_X[-20:]\n",
    "\n",
    "# Split the targets into training/testing sets\n",
    "diabetes_y_train = diabetes.target[:-20]\n",
    "diabetes_y_test = diabetes.target[-20:]\n",
    "\n",
    "# Create linear regression object\n",
    "regr = linear_model.LinearRegression()\n",
    "\n",
    "# Train the model using the training sets\n",
    "regr.fit(diabetes_X_train, diabetes_y_train)\n",
    "\n",
    "# The coefficients\n",
    "print('Coefficients: \\n', regr.coef_)\n",
    "# The intercept\n",
    "print('Intercept: \\n', regr.intercept_)\n",
    "# The mean squared error\n",
    "print(\"Mean squared error: %.2f\"\n",
    "      % np.mean((regr.predict(diabetes_X_test) - diabetes_y_test) ** 2))\n",
    "\n",
    "# Plot outputs\n",
    "plt.scatter(diabetes_X_test, diabetes_y_test,  color='black')\n",
    "plt.plot(diabetes_X_test, regr.predict(diabetes_X_test), color='blue',\n",
    "         linewidth=3)\n",
    "\n",
    "plt.xticks(())\n",
    "plt.yticks(())\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "regr.coef_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.47257544798227119"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "regr.score(diabetes_X_test, diabetes_y_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "1. Implemente o coeficiente de determinação e verifique o score obtido"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def total_sum_of_squares(y):\n",
    "    mean_y = np.mean(y)\n",
    "    return sum((v-mean_y)**2 for v in y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "def r_squared(y,yb):\n",
    "    #y = valor real; yb = valor real\n",
    "    return 1.0 - sum((y-yb)**2)/total_sum_of_squares(y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.472575447982\n",
      "0.472575447982\n"
     ]
    }
   ],
   "source": [
    "yb = regr.predict(diabetes_X_test)\n",
    "print r_squared(diabetes_y_test,yb)\n",
    "#usamos a função score do scikit-learn para verificar se não há erros\n",
    "print regr.score(diabetes_X_test,diabetes_y_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "2. Execute o notebook usando agora o dataset aerogerador na pasta do github."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('Coefficients: \\n', [array([ 56.04183372]), -213.71789253448549])\n",
      "Mean squared error: 717.69\n",
      "R-squared: 0.93\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAeQAAAFKCAYAAADMuCxnAAAABHNCSVQICAgIfAhkiAAAA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NH\nJQIAUAuer5C3bbMP4wULpN/9jjAGANSWZyvk996TLr5YymSKt3niCam3t359AgB4lycr5CeekC66\nqHgYz5uXDWzCGABQL54L5D/7M+nWW4t/vm1bdjnT/Pn16xMAAJ56ZX30qLRjR/HPT5/OvsYGAKDe\nPFUh/+Y3ha///d9nX18TxgCARvFUhRyJSCtWSK++OnXt1Clp4cLG9QkAAMljFfL8+dLLL0v79klv\nv52tigljAIAbeKpClqTzzpPWrWt0LwAAyOepChkAALcikAEAcAECGQAAFyCQAQBwAQIZAAAXIJAB\nAHABAhn10nadAAAA1klEQVQAABcgkAEAcAECGQAAFyCQAQBwAQIZAAAXIJABAHABAhkAABcgkAEA\ncAECGQAAFyCQAQBwAQIZAAAXIJABAHABAhkAABcgkAEAcAECGQAAFyCQAQBwgXmG7S6QpFdffbWG\nXQEAoPlMy84L7Nr5MpmM4818Pl+fpMcr7xYAAJ51ayaTeaLYh6aB3CrJkvRrSeeq1jUAAJrfBZKu\nkhTLZDIjxRoZBTIAAKgtJnUBAOACBDIAAC5AIAMA4AIEMgAALkAgAwDgAgQyAAAuQCADAOAC/x+a\nRod/nClIIAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f7f17a7d890>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "data = np.loadtxt(\"aerogerador.txt\",delimiter=\",\")\n",
    "#vamos embaralhar os dados antes de dividir treino e teste\n",
    "rdata = np.random.permutation(data)\n",
    "X = rdata[:,0]\n",
    "y = rdata[:,1]\n",
    "\n",
    "nt = int(len(X) * 0.8)\n",
    "X_train = X[:nt]\n",
    "X_test = X[nt:]\n",
    "y_train = y[:nt]\n",
    "y_test = y[nt:]\n",
    "#quando o o dataset possui apenas 1 feature, precisamos usar reshape para\n",
    "#evitar warnings (ou futuros erros) no scikit-learn\n",
    "X_train = X_train.reshape(-1,1)\n",
    "X_test = X_test.reshape(-1,1)\n",
    "\n",
    "regr = linear_model.LinearRegression()\n",
    "regr.fit(X_train, y_train)\n",
    "\n",
    "# The coefficients\n",
    "print('Coefficients: \\n', [regr.coef_ , regr.intercept_])\n",
    "# The mean squared error\n",
    "print(\"Mean squared error: %.2f\"\n",
    "      % np.mean((regr.predict(X_test) - y_test) ** 2))\n",
    "print (\"R-squared: %.2f\" % r_squared(regr.predict(X_test),y_test))\n",
    "\n",
    "# Plot outputs\n",
    "plt.scatter(X_test, y_test,  color='black')\n",
    "plt.plot(X_test, regr.predict(X_test), color='blue',\n",
    "         linewidth=3)\n",
    "\n",
    "plt.xticks(())\n",
    "plt.yticks(())\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
